<?php

namespace App\Http\Controllers\Common;

use App\Repositories\Common\ApiRepository;
use App\Repositories\Backend\DoctorRepository;
use Illuminate\Http\Request;

class Apicontroller extends BaseController
{

    public $repository;
    public $doctorRepository;

    public function __construct(
        ApiRepository $apiRepository,
        DoctorRepository $doctorRepository
    )
    {
        $this->repository = $apiRepository;
        $this->doctorRepository = $doctorRepository;
    }

    // 获取七牛上传token
    public function uploadToken(Request $request)
    {
        $result[1] = $this->repository->createToken();
        return $this->responseResult($result);
    }

    // 刷新缓存
    public function refreshCache()
    {
        $result = $this->repository->refreshCache();
        return $this->responseResult($result);
    }

    // 图片储存
    public function uploadimage(Request $request)
    {

        return $request->file;
//        return $this->responseResult($result);
    }

    public function doctorlist(Request $request)
    {
        $input = json_decode($request->input('data'), true);;
        return $this->doctorRepository->doctorlist($input);
    }
}
